// 开发测试使用
export const developLogin = async (loginUser: string, userpwd: string) => {
  const loginInfoReq = await fetch("/api/secure/v1/users/login-info", {});
  const loginInfoRes = await loginInfoReq.json();
  console.log(loginInfoRes, "login-info");

  if (loginInfoRes.errorCode === 100000000) {
    const req = await fetch("/api/secure/v1/login/userlogin", {
      method: "POST",
      headers: {
        "Content-Type": "application/json;charset=UTF-8",
      },
      body: JSON.stringify({
        account: loginUser,
        ip: [],
        mac: [],
        password: userpwd,
        terminal: 0,
        valid_code_value: "",
      }),
    });
    const res = await req.json();
    const { data } = res;
    const token = data.token;
    document.cookie = `tem_token=${window.btoa(encodeURIComponent(token))}`;
    document.cookie = `token=${token}`;
  }
};
